﻿<UserControl x:Name="userControl" x:Class="DoubanFM.NotifyIcon.BalloonSongInfo"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:tb="http://www.hardcodet.net/taskbar"
             xmlns:resx="clr-namespace:DoubanFM.Resources"
			 mc:Ignorable="d" 
			 d:DesignHeight="300" d:DesignWidth="300"
			 TextOptions.TextFormattingMode="Display"
			 Foreground="White" MouseLeftButtonUp="userControl_MouseLeftButtonUp" FontFamily="{Binding MainWindow.FontFamily, Source={x:Static Application.Current}}">
	<UserControl.Resources>
		<Storyboard x:Key="ShowCoverSmooth">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Cover">
				<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="FadeIn">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="userControl">
				<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="FadeOut" Completed="FadeOut_Completed" >
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="userControl">
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</UserControl.Resources>
	<UserControl.Triggers>
		<EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonShowing">
			<BeginStoryboard Storyboard="{StaticResource FadeIn}"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonClosing">
			<BeginStoryboard Storyboard="{StaticResource FadeOut}"/>
		</EventTrigger>
	</UserControl.Triggers>
	<Grid>
		<Border x:Name="ShadowBorder" Margin="10" Background="{Binding MainWindow.Background, Source={x:Static Application.Current}}">
			<Border.Effect>
				<DropShadowEffect ShadowDepth="0" BlurRadius="10"/>
			</Border.Effect>
		</Border>
		<Grid Margin="{Binding Margin, ElementName=ShadowBorder}" MinWidth="300" MaxWidth="500" Height="104">
			<Grid x:Name="LayoutRoot" Margin="10">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<Grid Width="{Binding ActualHeight, ElementName=LayoutRoot}" Height="{Binding Width}" Margin="0,0,10,0">
					<Image Source="/DoubanFM;component/Images/DoubanFM_NoCover.png" Stretch="UniformToFill"/>
					<Image x:Name="Cover" Source="{Binding CurrentSong.Picture, Source={StaticResource Player}}" Stretch="UniformToFill" RenderOptions.BitmapScalingMode="HighQuality" Opacity="0" />
					<Image Width="20" Height="20" Margin="5,5,-5,-5" HorizontalAlignment="Right" VerticalAlignment="Bottom" Source="/DoubanFM;component/Images/DoubanFM_Like_Like.png" Visibility="{Binding IsLiked, Source={StaticResource Player}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
				</Grid>
				<Grid x:Name="SongInfo" Grid.Column="1">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
						<RowDefinition/>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="Auto"/>
					</Grid.RowDefinitions>
					<TextBlock x:Name="TbChannel" Text="{Binding CurrentChannel, Source={StaticResource Player}, TargetNullValue={x:Static resx:Resources.WindowTitle}}" TextTrimming="CharacterEllipsis"/>
					<TextBlock x:Name="TbTitle" Grid.Row="1" FontSize="20" Text="{Binding CurrentSong.Title, Source={StaticResource Player}}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
					<TextBlock x:Name="TbArtist" Grid.Row="2" FontSize="14" Text="{Binding CurrentSong.Artist, Source={StaticResource Player}}" TextTrimming="CharacterEllipsis"/>
					<TextBlock x:Name="TbAlbum" Grid.Row="3" FontSize="14" Text="{Binding CurrentSong.Album, Source={StaticResource Player}}" TextTrimming="CharacterEllipsis"/>
				</Grid>
			</Grid>
		</Grid>
	</Grid>
</UserControl>
